#include"CommandServer.hpp"
#include"Command.hpp"
#include<memory>

void User(std::string proc)
{
    std::cout<<"Usage: "<<proc<<" localport"<<std::endl;
}

//serevrport
int main(int args,char*argv[])
{   
    if(args!=2)
    {
        User(argv[0]);
        exit(0);
    }

    EnableConsoleLogStrategy();
    uint16_t severport=std::stoi(argv[1]);
    Command cmdobj;
    std::unique_ptr<CommandServer> tsver=std::make_unique<CommandServer>(severport,
        [&cmdobj](const std::string &cmd)->std::string
        {
            return cmdobj.Exec(cmd);
        }
    );
    // std::cout<<"hhh"<<std::endl;
    tsver->Init();
    tsver->Start();
    return 0;
}